<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
 
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title></title>
    <link href="layout.css" rel="stylesheet" type="text/css">
    <!--[if lte IE 8]><script language="javascript" type="text/javascript" src="../excanvas.min.js"></script><![endif]-->
    <script language="javascript" type="text/javascript" src="../jquery.js"></script>
    <script language="javascript" type="text/javascript" src="../jquery.flot.js"></script>
	
	<script type="text/javascript">
	
	
	function barrido(stopbarrido)
		{	
			
			
			
			for(var j=0 ; j < 20000 ; j=j+1)
				{
				
		
				var t=setTimeout("graficado()",3000);
				
					}	
				
		} 
	
	
	function graficado()
	{
	
	
	var startf, stopf, fft, sens, aten; 
	var count =60;
	var random = [];
	var name1 = document.getElementById("StartFrecuency");
			    startf = parseFloat(name1.value);
	var name2 = document.getElementById("StopFrecuency");
			    stopf = parseFloat(name2.value);
	var name3 = document.getElementById("FFTSize");
			    fft = parseFloat(name3.value);
	var name4 = document.getElementById("sensibilidad");
			    sens = parseFloat(name4.value);
	var name5 = document.getElementById("atenuacion");
			    aten = parseFloat(name5.value);
	//document.write(name5.value); 
	
	if (name1.value != "" && name2.value != "" && name3.value != "" &&name4.value != "" &&name5.value != "")
	{
	
	if (startf < stopf)
    {
	//aca le mandamos fruta
	
    for (var i =startf ; i < stopf; i += count) {
        random.push([i, Math.random(i)*-100]);
        
    }

    var plot = $.plot($("#placeholder"),
           [ { data: random, label: "Barrido"} ], {
               series: {
                   lines: { show: true },
                   points: { show: false }
               },
			  

               grid: { hoverable: true, clickable: false },
               yaxis: { min: -120, max: 5}
             });

    
    var previousPoint = null;
    $("#placeholder").bind("plothover", function (event, pos, item) {
        $("#x").text(pos.x.toFixed(2));
        $("#y").text(pos.y.toFixed(2));
       
    });

    }
			  
	else {alert('"Start Frequency" debe ser menor que Stop Frequency');}
	}
	else {alert('"Debe ingresar todos los parametros"');}
	}
	
	
	 
	 
	</script>
</head>
 
<body>

    <h1></h1>
	
<div id="placeholder" style="width:1000px;height:350px"></div>
<p id="hoverdata">
Frecuencia:(<span id="x">0</span>)[HZ] <p> Amplitud:(<span id="y">0</span>)[dBm] <span id="clickdata"></span></p>

<u><h3>Ingrese los Siguientes parámetros:</h3></u>
	<form action="#">
	
	-Sensibilidad  	
	<select name="ComboBox" size="1" id = "sensibilidad" onChange="">
	<option value="0">0</option>
	<option value="1">1</option>
	<option value="2">2</option>
	</select> <P>

	-Atenuación 
	<select name="ComboBox" id = "atenuacion" size="1" onChange="">
	<option value="0">0</option>
	<option value="5">5</option>
	<option value="10">10</option>
	<option value="10">15</option>
	</select> <P>
	
	-FFT Size
	<select name="ComboBox" size="1" id= "FFTSize" onChange="">
	<option value="128">128</option>
	<option value="256">256</option>
	<option value="512">512</option>
	<option value="1024">1024</option>
	</select> <P>
	
	-Tipo de Barrido
	<select name="ComboBox" size="1" id= "tipodebarrido" onChange="">
	<option value="0">Slow Sweep</option>
	<option value="1">Fast Sweep</option>
	</select> <P>
	
	-Start Frequency <input type="text" name="textbox"  id="StartFrecuency" value="" />  Hz   (Ej: 100khz ---> 100e3) <P>
	
	-Stop Frequency	 <input type="text" name="textbox"  id="StopFrecuency"  value="" />  Hz   <P>
	
	
	<input type="button" name = "button" value="Empezar Barrido" onclick="barrido()" />
    <input type="button" name = "button" value="Terminar Barrido" onclick="" /><p>
    <INPUT TYPE="BUTTON" name = "button" VALUE="Simular" onClick="graficado()"><p>



<script type="text/javascript">

</script>

 </body>
</html>
